package wrs.hcs.tc;

import org.openqa.selenium.WebDriver;

import wrs.hcs.functions.*;

public class WebApp_Admitted {

	
	public static WebDriver driver;
	public static String lName;
	public static String pin;
	
	public void transact() throws Exception
	{
		Webdriver d = new Webdriver();
		Login log = new Login();
		Logout out = new Logout();
		AdminConsole ac = new AdminConsole();
		driver = d.startUp();
		
		Hcs_NewPatient newPatient = new Hcs_NewPatient();
		//Criteria for login in hcs: "admission", "nursing", "billing"
		log.hcs(driver, "admission"); 									//login
		String getIt = newPatient.createPatient(driver, "adult");				//new patient in hcs
		
		//Split string for PIN and LASTNAME
		String[] arrString = getIt.split(",");
		lName = arrString[0];
		pin = arrString[1];
		
		Hcs_Admission admit = new Hcs_Admission();
		admit.admin(driver, pin);
		
		WebApp_Single s = new WebApp_Single();
		s.wellness(driver, lName, pin, false, "basic"); 							//create wrs transaction in webapp for patient
		
		driver = d.startUp();
		log.admin(driver); 												//login on wrs admin
		AdminConsole_Single console = new AdminConsole_Single();
		console.admin(driver, pin, "inpatient");   						//update on admin and forward to hcs
		out.admin(driver);
		
		log.hcs(driver, "nursing");
		Hcs_Nursing pack = new Hcs_Nursing();
		pack.discharge(driver, pin); 									//fill up discharge instructions
		pack.admit(driver, pin); 										//assign pf and discharge
		out.hcs(driver);
		
		//driver = d.startUp();
		log.hcs(driver, "billing"); 									//das discharge
		Hcs_Billing bill = new Hcs_Billing();
		bill.regular(driver, pin); 
		out.hcs(driver);
		
		log.admin(driver); 												//login on wrs admin
		ac.forward(driver, pin);   								//update on admin and forward to hcs
		out.admin(driver);
		log.hcs(driver, "admission");
		admit.history(driver, pin);
	}
		
		
}
